package logic

import (
	"context"
	"furniture/furniturerpc/furniturerpc"

	"furniture/api/internal/svc"
	"furniture/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type FurnitureListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewFurnitureListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FurnitureListLogic {
	return &FurnitureListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *FurnitureListLogic) FurnitureList(req *types.FurnitureListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	list, err := l.svcCtx.FurnitureRpc.FurnitureList(l.ctx, &furniturerpc.FurnitureListRequest{})
	if err != nil {
		return &types.Response{
			Code:    500,
			Message: "展示失败",
			Data:    nil,
		}, nil
	} else {
		return &types.Response{
			Code:    500,
			Message: "展示成功",
			Data:    list,
		}, nil
	}

}
